package org.j4me.deviceinfo.data;

import java.util.StringTokenizer;

import org.dom4j.Element;

public class Kvp {
	
	private String _key;
	private String _value;

	public Kvp(String key, String value) {
		_key = key;
		_value = value;
	}
	
	public Kvp(Element elt) {
		_key = elt.attributeValue("key");
		_value = elt.attributeValue("value");
		
	}
	
	public void toXml(Element elt)
	{
		
		elt.addAttribute("key", _key);
		elt.addAttribute("value",DeviceDb.encode( _value));
	}
	
	
	

	public boolean equals(Object obj) {
		if (obj instanceof Kvp) {
			Kvp kvp = (Kvp) obj;
			return ((_key == kvp._key || (_key != null && _key.equals(kvp._key))) && (_value == kvp._value || (_value != null && _value.equals(kvp._value))));
		}
		return super.equals(obj);
	}

	public String getKey() {
		return _key;
	}

	public String getValue() {
		return _value;
	}
}
